<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script src="spellcheck_test.js"></script>
<script>
spellcheck_test(
    '<div contenteditable>|</div>',
    document => {
      document.getSelection().setClipboardData(
          '<img src="../resources/abe.png"> zz zz.');
      document.execCommand('paste');
    },
    '<div contenteditable><img src="../resources/abe.png"> #zz# #zz#.</div>',
    'Mark misspelled words after pasting mixed content of image and text.');

// Create HTML longer than the spellchecker's chunk size 16384.
const longHTML = `<img src="../resources/abe.png"> zz${' ah'.repeat(5461)}`;
const expectedHTML = `<img src="../resources/abe.png"> #zz#${' ah'.repeat(5461)}`;
spellcheck_test(
    '<div contenteditable>|</div>',
    document => {
      document.getSelection().setClipboardData(longHTML);
      document.execCommand('paste');
    },
    '<div contenteditable>' + expectedHTML + '</div>',
    'Mark misspelled word after pasting mixed content of image and long text.');
</script>

